USE [CASASHOW]
GO

IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP09_EFETUA_COMPRA]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP09_EFETUA_COMPRA]
GO

/****** Object:  StoredProcedure [dbo].[SP09_EFETUA_COMPRA]    Script Date: 11/19/2013 12:02:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[SP09_EFETUA_COMPRA]
	   @ID_USUARIO INT,
	   @ID_INGRESSO INT,
	   @QT_INGRESSO INT
AS
/******      Declaracao das variaveis locais - NUNCA utilize os parametros de entrada nos comandos SQL 
*/

DECLARE @V_ID_USUARIO INT
DECLARE @V_ID_INGRESSO INT
DECLARE @V_QT_INGRESSO INT
SET @V_ID_USUARIO = @ID_USUARIO
SET @V_ID_INGRESSO = @ID_INGRESSO
SET @V_QT_INGRESSO = @QT_INGRESSO

/******      Crie a logica da procedure abaixo
*/

INSERT INTO dbo.TB06_COMPRA
        ( ID_USUARIO ,
          ID_INGRESSO ,
          QT_INGRESSO
        )
VALUES  (@V_ID_USUARIO, @V_ID_INGRESSO, @V_QT_INGRESSO)